<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Miscellaneous Utilities: libxfce4util Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="libxfce4util Reference Manual">
<link rel="up" href="libxfce4util-utilities.html" title="Xfce Utilities">
<link rel="prev" href="libxfce4util-File-Utilities.html" title="File Utilities">
<link rel="next" href="libxfce4util-Unicode-Support-Functions.html" title="Unicode Manipulation">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#libxfce4util-Miscellaneous-Utilities.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="libxfce4util-utilities.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libxfce4util-File-Utilities.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libxfce4util-Unicode-Support-Functions.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libxfce4util-Miscellaneous-Utilities"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libxfce4util-Miscellaneous-Utilities.top_of_page"></a>Miscellaneous Utilities</span></h2>
<p>Miscellaneous Utilities — miscellaneous file-related utility functions.</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libxfce4util-Miscellaneous-Utilities.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">const <span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-get-homedir" title="xfce_get_homedir ()">xfce_get_homedir</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-get-homefile" title="xfce_get_homefile()">xfce_get_homefile</a><span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-get-homefile-r" title="xfce_get_homefile_r ()">xfce_get_homefile_r</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-get-userdir" title="xfce_get_userdir ()">xfce_get_userdir</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-get-userfile" title="xfce_get_userfile()">xfce_get_userfile</a><span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-get-userfile-r" title="xfce_get_userfile_r ()">xfce_get_userfile_r</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-gethostname" title="xfce_gethostname ()">xfce_gethostname</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-expand-variables" title="xfce_expand_variables ()">xfce_expand_variables</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-append-quoted" title="xfce_append_quoted ()">xfce_append_quoted</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-expand-desktop-entry-field-codes" title="xfce_expand_desktop_entry_field_codes ()">xfce_expand_desktop_entry_field_codes</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-unescape-desktop-entry-value" title="xfce_unescape_desktop_entry_value ()">xfce_unescape_desktop_entry_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libxfce4util-Miscellaneous-Utilities.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;libxfce4util/libxfce4util.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libxfce4util-Miscellaneous-Utilities.description"></a><h2>Description</h2>
<p>Miscellaneous file-related utility functions.</p>
</div>
<div class="refsect1">
<a name="libxfce4util-Miscellaneous-Utilities.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="xfce-get-homedir"></a><h3>xfce_get_homedir ()</h3>
<pre class="programlisting">const <span class="returnvalue">gchar</span> *
xfce_get_homedir (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Similar to <code class="function">g_get_home_dir()</code> in functionality but will never return NULL.
While <code class="function">g_get_home_dir()</code> may return NULL under certain circumstances, this
function is garantied to never ever return NULL, but always return a
valid character pointer with the absolute path to the user's home directory.</p>
<p>The returned string is owned by libxfce4util and must not be freed by
the caller.</p>
<div class="refsect3">
<a name="xfce-get-homedir.returns"></a><h4>Returns</h4>
<p> the path to the current user's home directory.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="xfce-get-homefile"></a><h3>xfce_get_homefile()</h3>
<pre class="programlisting">#define             xfce_get_homefile(...)</pre>
</div>
<hr>
<div class="refsect2">
<a name="xfce-get-homefile-r"></a><h3>xfce_get_homefile_r ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
xfce_get_homefile_r (<em class="parameter"><code><span class="type">gchar</span> *buffer</code></em>,
                     <em class="parameter"><code><span class="type">size_t</span> length</code></em>,
                     <em class="parameter"><code>const <span class="type">gchar</span> *format</code></em>,
                     <em class="parameter"><code>...</code></em>);</pre>
<p>Similar in functionality to <a class="link" href="libxfce4util-Miscellaneous-Utilities.html#xfce-get-homefile" title="xfce_get_homefile()"><span class="type">xfce_get_homefile</span></a>, but uses a user
defined <em class="parameter"><code>buffer</code></em>
 instead of allocating a new buffer.</p>
<p>xfce_get_homefile_r uses safe string operations, that says, it garanties
that the resulting string is always zero terminated, as long as the
<em class="parameter"><code>length</code></em>
 is greater than zero.</p>
<div class="refsect3">
<a name="xfce-get-homefile-r.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>buffer</p></td>
<td class="parameter_description"><p>pointer to a user provided destination buffer.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>size of <em class="parameter"><code>buffer</code></em>
in bytes.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>printf style format string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to substitute in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="xfce-get-homefile-r.returns"></a><h4>Returns</h4>
<p> pointer to <em class="parameter"><code>buffer</code></em>
.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="xfce-get-userdir"></a><h3>xfce_get_userdir ()</h3>
<pre class="programlisting">const <span class="returnvalue">gchar</span> *
xfce_get_userdir (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Safe way to retrieve the path to the user's ".xfce4" directory. The path
to the current user's ".xfce4" directory is either taken from the
environment variable XFCE4HOME if defined, or if unset, is gained by
concatenating the path to the user's home directory and the ".xfce4".
That says, it will, by default, return the path "$HOME/.xfce4", where
$HOME is replaced with the absolute path to the user's home directory.</p>
<p>The returned string is managed by libxfce4util and must not be freed by
the caller.</p>
<div class="refsect3">
<a name="xfce-get-userdir.returns"></a><h4>Returns</h4>
<p> the path to the current user's ".xfce4" directory.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="xfce-get-userfile"></a><h3>xfce_get_userfile()</h3>
<pre class="programlisting">#define             xfce_get_userfile(...)</pre>
</div>
<hr>
<div class="refsect2">
<a name="xfce-get-userfile-r"></a><h3>xfce_get_userfile_r ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
xfce_get_userfile_r (<em class="parameter"><code><span class="type">gchar</span> *buffer</code></em>,
                     <em class="parameter"><code><span class="type">size_t</span> length</code></em>,
                     <em class="parameter"><code>const <span class="type">gchar</span> *format</code></em>,
                     <em class="parameter"><code>...</code></em>);</pre>
<div class="refsect3">
<a name="xfce-get-userfile-r.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>buffer</p></td>
<td class="parameter_description"><p>user provided destination buffer.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>size of <em class="parameter"><code>buffer</code></em>
in bytes.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>printf style format string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments to substitute in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="xfce-get-userfile-r.returns"></a><h4>Returns</h4>
<p> pointer to <em class="parameter"><code>buffer</code></em>
.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="xfce-gethostname"></a><h3>xfce_gethostname ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
xfce_gethostname (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Portable way to query the hostname of the node running the process. This
function does not ever return <code class="literal">NULL</code>, but always returns a string containing
the current node's hostname.</p>
<div class="refsect3">
<a name="xfce-gethostname.returns"></a><h4>Returns</h4>
<p> the current node's hostname. The string has to be freed
by the caller using <code class="function">g_free()</code>.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="xfce-expand-variables"></a><h3>xfce_expand_variables ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
xfce_expand_variables (<em class="parameter"><code>const <span class="type">gchar</span> *command</code></em>,
                       <em class="parameter"><code><span class="type">gchar</span> **envp</code></em>);</pre>
<p>Expands shell like environment variables and tilde (~/ and ~user/ are both supported)
in <em class="parameter"><code>command</code></em>
.</p>
<div class="refsect3">
<a name="xfce-expand-variables.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>command</p></td>
<td class="parameter_description"><p>Input string or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>envp</p></td>
<td class="parameter_description"><p>Addition environment variables to take into account. These
variables have higher priority than the ones in the process's
environment.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="xfce-expand-variables.returns"></a><h4>Returns</h4>
<p> <code class="literal">NULL</code> on error, else the string, which should be freed using
<code class="function">g_free()</code> when no longer needed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-4-2.html#api-index-4.2">4.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="xfce-append-quoted"></a><h3>xfce_append_quoted ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
xfce_append_quoted (<em class="parameter"><code><span class="type">GString</span> *string</code></em>,
                    <em class="parameter"><code>const <span class="type">gchar</span> *unquoted</code></em>);</pre>
<div class="warning">
<p><code class="literal">xfce_append_quoted</code> has been deprecated since version 4.17 and should not be used in newly-written code.</p>
<p>Renamed to <a class="link" href="libxfce4util-Xfce-String-Functions.html#xfce-g-string-append-quoted" title="xfce_g_string_append_quoted ()"><code class="function">xfce_g_string_append_quoted()</code></a></p>
</div>
<p>An alias of <a class="link" href="libxfce4util-Xfce-String-Functions.html#xfce-g-string-append-quoted" title="xfce_g_string_append_quoted ()"><code class="function">xfce_g_string_append_quoted()</code></a>.</p>
<div class="refsect3">
<a name="xfce-append-quoted.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>A <span class="type">GString</span>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>unquoted</p></td>
<td class="parameter_description"><p>A literal string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="xfce-expand-desktop-entry-field-codes"></a><h3>xfce_expand_desktop_entry_field_codes ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
xfce_expand_desktop_entry_field_codes (<em class="parameter"><code>const <span class="type">gchar</span> *command</code></em>,
                                       <em class="parameter"><code><span class="type">GSList</span> *uri_list</code></em>,
                                       <em class="parameter"><code>const <span class="type">gchar</span> *icon</code></em>,
                                       <em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
                                       <em class="parameter"><code>const <span class="type">gchar</span> *uri</code></em>,
                                       <em class="parameter"><code><span class="type">gboolean</span> requires_terminal</code></em>);</pre>
<p>Expands field codes in <em class="parameter"><code>command</code></em>
 according to Freedesktop.org Desktop Entry Specification.</p>
<div class="refsect3">
<a name="xfce-expand-desktop-entry-field-codes.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>command</p></td>
<td class="parameter_description"><p>Input string (command to expand) or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>uri_list</p></td>
<td class="parameter_description"><p>Input string list (filename/URL field) or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>icon</p></td>
<td class="parameter_description"><p>Input string (icon field) or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>Input string (name field) or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description"><p>Input string (URI field) or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>requires_terminal</p></td>
<td class="parameter_description"><p>Input boolean.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="xfce-expand-desktop-entry-field-codes.returns"></a><h4>Returns</h4>
<p> <code class="literal">NULL</code> on error, else the string, which should be freed using <code class="function">g_free()</code> when
no longer needed.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="xfce-unescape-desktop-entry-value"></a><h3>xfce_unescape_desktop_entry_value ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
xfce_unescape_desktop_entry_value (<em class="parameter"><code>const <span class="type">gchar</span> *value</code></em>);</pre>
<p>Unescapes sequences in <em class="parameter"><code>value</code></em>
 according to Freedesktop.org Desktop Entry Specification.</p>
<div class="refsect3">
<a name="xfce-unescape-desktop-entry-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>Value string to replace escape sequences.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="xfce-unescape-desktop-entry-value.returns"></a><h4>Returns</h4>
<p> <code class="literal">NULL</code> on error, else the string, which should be freed using <code class="function">g_free()</code> when
no longer needed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-4-18.html#api-index-4.18">4.18</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>